package com.example.config;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import com.alibaba.nacos.api.utils.StringUtils;
import org.springframework.context.annotation.Configuration;

import javax.servlet.http.HttpServletRequest;
import java.nio.channels.IllegalChannelGroupException;
import java.util.Enumeration;

//@Configuration
public class SentinelAuthorization implements RequestOriginParser {
    @Override
    public String parseOrigin(HttpServletRequest httpServletRequest) {
        String token = httpServletRequest.getHeader("token");
        System.out.println(token);
       if(StringUtils.isEmpty(token)){
           throw  new RuntimeException("参数不和法");
       }
       return token;
    }
}
